import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter_app/utils/dio_http.dart';
import 'package:flutter_app/widgets/commom_image.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';

class HouseRecommendItem extends StatefulWidget {
  const HouseRecommendItem(
      {Key? key, required this.title, required this.desc, required this.imgSrc})
      : super(key: key);
  final String title;
  final String desc;
  final String imgSrc;

  @override
  State<HouseRecommendItem> createState() => _HouseRecommendItemState();
}

class _HouseRecommendItemState extends State<HouseRecommendItem> {
  @override
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        Navigator.pushNamed(context, '/');
      },
      child: Container(
        padding: const EdgeInsetsDirectional.fromSTEB(5, 0, 5, 0),
        margin: const EdgeInsets.only(top: 15.0),
        color: Colors.white,
        height: 70,
        width: (MediaQuery.of(context).size.width - 20 * 3) / 2,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            SizedBox(
              width: (MediaQuery.of(context).size.width - 20 * 3) / 2 - 40 * 2,
              child: Column(
                children: [
                  const SizedBox(
                    height: 12,
                  ),
                  Text(
                    widget.title,
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                  ),
                  const SizedBox(
                    height: 5,
                  ),
                  Text(
                    widget.desc,
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                  )
                ],
              ),
            ),
            SizedBox(
              height: 50,
              child: CommonImage(
                src: widget.imgSrc,
              ),
            )
          ],
        ),
      ),
    );
  }
}
